<?php
class Books extends Controller {
	
	function __construct() {
		parent::Controller();
		$this->load->helper('url');
		//$this->load->database();
	}
	
	function index() {
		
		//load pagination class
		$this->load->library('pagination');

		$offset=$this->uri->segment(3);

        $limit=5;

        $this->db->limit($limit, $offset);
        $query = $this->db->get('membership');

        $config['base_url'] = site_url().'/books/index/';
        $config['total_rows'] = $this->db->count_all('membership');
        $config['per_page'] = $limit;
        $this->pagination->initialize($config);
        $paginator=$this->pagination->create_links();

        $data = array(
            'query' => $query,
            'paginator'=>$paginator
        );

        $this->load->view('books_view',$data);
	}
}
?>